package com.power.util;

import com.power.contant.HttpConstants;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

/**
 *
 */
public class ResponseUtils {

    public static void write(HttpServletResponse response, String json) {
        response.setContentType(HttpConstants.APPLICATION_JSON_UTF_8);
        response.setCharacterEncoding(HttpConstants.UTF_8);
        PrintWriter out = null;
        try {
            out = response.getWriter();
            out.write(json);
            out.flush();
            out.close();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }

    }

}
